import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../models/mathematician.dart';

class MathematicianDetailScreen extends StatelessWidget {
  final Mathematician mathematician;

  const MathematicianDetailScreen({
    super.key,
    required this.mathematician,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(mathematician.name),
        actions: [
          IconButton(
            icon: const Icon(Icons.edit),
            onPressed: () {
              context.go('/admin/editMathematician?mathematicianId=${mathematician.id}');
            },
          ),
        ],
      ),
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            // 数学家图片
            Container(
              width: double.infinity,
              height: 300,
              decoration: BoxDecoration(
                color: Colors.grey[200],
                image: DecorationImage(
                  image: AssetImage(mathematician.image),
                  fit: BoxFit.cover,
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  // 基本信息
                  Row(
                    children: [
                      Container(
                        padding: const EdgeInsets.symmetric(
                          horizontal: 8,
                          vertical: 4,
                        ),
                        decoration: BoxDecoration(
                          color: Colors.blue.withOpacity(0.1),
                          borderRadius: BorderRadius.circular(4),
                        ),
                        // child: Text(
                        //   mathematician.country,
                        //   style: const TextStyle(
                        //     color: Colors.blue,
                        //     fontWeight: FontWeight.bold,
                        //   ),
                        // ),
                      ),
                      const SizedBox(width: 8),
                      Container(
                        padding: const EdgeInsets.symmetric(
                          horizontal: 8,
                          vertical: 4,
                        ),
                        decoration: BoxDecoration(
                          color: Colors.green.withOpacity(0.1),
                          borderRadius: BorderRadius.circular(4),
                        ),
                        child: Text(
                          mathematician.title,
                          style: const TextStyle(
                            color: Colors.green,
                            fontWeight: FontWeight.bold,
                          ),
                        ),
                      ),
                    ],
                  ),
                  const SizedBox(height: 16),
                  // 生平简介
                  const Text(
                    '生平简介',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 8),
                  Text(
                    mathematician.introduction,
                    style: const TextStyle(
                      fontSize: 16,
                      height: 1.5,
                    ),
                  ),
                  const SizedBox(height: 24),
                  // 主要成就
                  const Text(
                    '主要成就',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  const SizedBox(height: 8),
                  // ...mathematician.contributions.map((achievement) => Padding(
                  //   padding: const EdgeInsets.only(bottom: 8.0),
                  //   child: Row(
                  //     crossAxisAlignment: CrossAxisAlignment.start,
                  //     children: [
                  //       const Icon(
                  //         Icons.star,
                  //         color: Colors.amber,
                  //         size: 20,
                  //       ),
                  //       const SizedBox(width: 8),
                  //       Expanded(
                  //         child: Text(
                  //           achievement,
                  //           style: const TextStyle(
                  //             fontSize: 16,
                  //             height: 1.5,
                  //           ),
                  //         ),
                  //       ),
                  //     ],
                  //   ),
                  // )),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
} 